#ifndef SQLPARSER_CREATE_STATEMENT_H
#define SQLPARSER_CREATE_STATEMENT_H

#include "SQLStatement.h"


#include <ostream>

namespace ment {
	struct SelectStatement;

	enum class DataType {
		UNKNOWN,
		INT,
		LONG,
		FLOAT,
		DOUBLE,
		CHAR,
		VARCHAR,
		TEXT,
		BOOL
	};


	struct ColumnType {
		ColumnType() = default;
		ColumnType(DataType data_type, int64_t length = 0);
		DataType data_type;
		int64_t length;  
	};

	bool operator==(const ColumnType& lhs, const ColumnType& rhs);
	bool operator!=(const ColumnType& lhs, const ColumnType& rhs);
	
	struct ColumnDefinition {
		ColumnDefinition(char* name, ColumnType type, bool nullable);
		virtual ~ColumnDefinition();

		char* name;
		ColumnType type;
		bool nullable;

		bool isPrimaryKey = false;
	};
	
	enum CreateType {
		ForCreateTable,
		ForCreateTableFromTbl,
		ForCreateView,
		ForCreateSchema,
		ForCreateIndex
	};

	struct CreateStatement : SQLStatement {
		CreateStatement(CreateType type);
		virtual ~CreateStatement();
		virtual std::string execute(std::string username="default");


		CreateType type;
		bool ifNotExists; 
		char* filePath;  
		char* schema;     
		char* tableName; 
		char* onWhich;
		std::vector<ColumnDefinition*>* columns; 
		std::vector<char*>* viewColumns;
		SelectStatement* select;
	};

} 

#endif
